home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / Include / sun4c.md / vmMach.h < prev    next >
C/C++ Source or Header  |  1991-07-28  |  4KB  |  142 lines

  1. /*
  2.  * vmMach.h
  3.  *
  4.  *         Machine dependent virtual memory data structures and procedure 
  5.  *    headers.
  6.  *
  7.  * Copyright (C) 1985 Regents of the University of California
  8.  * All rights reserved.
  9.  *
  10.  *
  11.  * $Header: /sprite/src/kernel/vm/sun3.md/RCS/vmMach.h,v 9.11 91/07/26 17:05:47 shirriff Exp $ SPRITE (Berkeley)
  12.  */
  13.  
  14. #ifndef _VMMACH
  15. #define _VMMACH
  16.  
  17. #ifdef KERNEL
  18. #include "vm.h"
  19. #include "vmSunConst.h"
  20. #include "proc.h"
  21. #include "net.h"
  22. #else
  23. #include <kernel/vm.h>
  24. #include <kernel/vmSunConst.h>
  25. #include <kernel/proc.h>
  26. #include <kernel/net.h>
  27. #endif
  28.  
  29. /*
  30.  * Since the index into the segment table is passed to various
  31.  * machine-dependent routines, its size must depend on the hardware size
  32.  * or else be the largest size used, which would waste space.  So far, this
  33.  * has only been generalized for the various types of sun4s.
  34.  */
  35. #ifdef sun4
  36. #ifdef sun4c
  37. typedef    unsigned short    VMMACH_SEG_NUM;    /* should be unsigned char, but fails */
  38. #else
  39. typedef    unsigned short    VMMACH_SEG_NUM;
  40. #endif    /* sun4c */
  41. #endif    /* sun4 */
  42.  
  43. /*
  44.  * Machine dependent data for each software segment.  The data for each 
  45.  * segment is a hardware segment table that contains one entry for each
  46.  * hardware segment in the software segment's virtual address space.
  47.  * A hardware context is made up of several software segments.  The offset
  48.  * field in this struct is the offset into the context where this software
  49.  * segment begins.  The offset is in terms of hardware segments.
  50.  */
  51. typedef struct VmMach_SegData {
  52. #ifdef sun4
  53.     VMMACH_SEG_NUM    *segTablePtr;
  54. #else
  55.     unsigned char     *segTablePtr;
  56. #endif /* sun4 */
  57.     int            offset;
  58.     int            numSegs;
  59. } VmMach_SegData;
  60.  
  61. /*
  62.  * Machine dependent shared memory data
  63.  */
  64. typedef struct VmMach_SharedData {
  65.     int        *allocVector;           /* Allocated block vector. */
  66.     int         allocFirstFree;         /* First free block. */
  67. } VmMach_SharedData;
  68.  
  69. /*
  70.  * Machine dependent data for each process.
  71.  */
  72. typedef struct VmMach_ProcData {
  73.     struct VmMach_Context *contextPtr;    /* The context for the process. */
  74.     struct Vm_Segment    *mapSegPtr;    /* Pointer to segment which is mapped
  75.                      * into this processes address
  76.                      * space. */
  77.     unsigned int    mapHardSeg;    /* Address in the mapped seg where 
  78.                      * the mapping begins. */
  79.     struct Vm_SegProcList *sharedPtr;    /* Shared memory data */
  80.     VmMach_SharedData   sharedData;     /* Data for shared memory. */
  81. } VmMach_ProcData;
  82.  
  83. typedef unsigned int    VmMachPTE;
  84.  
  85. /*
  86.  * Exported machine dependent functions.
  87.  */
  88.  
  89. /*
  90.  * Manipulating protection.
  91.  */
  92. extern void VmMach_SetProtForDbg _ARGS_((Boolean readWrite, int numBytes,
  93.     Address addr));
  94. /*
  95.  * Routines to copy data to/from user space.
  96.  */
  97. extern int  VmMachCopyEnd _ARGS_((void));
  98. extern ReturnStatus VmMach_IntMapKernelIntoUser _ARGS_((unsigned int
  99.     kernelVirtAddr, int numBytes, unsigned int userVirtAddr,
  100.     Address *newAddrPtr));
  101.  
  102.  
  103. /*
  104.  * Routines for the INTEL device driver.
  105.  */
  106. extern void VmMach_MapIntelPage _ARGS_((Address virtAddr));
  107. extern void VmMach_UnmapIntelPage _ARGS_((Address virtAddr));
  108.  
  109. /*
  110.  * Routines for DMA
  111.  */
  112. extern Address VmMach_32BitDMAAlloc _ARGS_((int numBytes, Address srcAddr));
  113. extern void VmMach_32BitDMAFree _ARGS_((int numBytes, Address mapAddr));
  114. extern ReturnStatus VmMach_DMAAllocContiguous _ARGS_((
  115.     Net_ScatterGather *inScatGathPtr, int scatGathLength,
  116.     Net_ScatterGather *outScatGathPtr));
  117.  
  118. /*
  119.  * Device mapping.
  120.  */
  121. extern Address VmMach_MapInDevice _ARGS_((Address devPhysAddr, int type));
  122. /*
  123.  * Network mapping routines.
  124.  */
  125. extern Address VmMach_NetMemAlloc _ARGS_((int numBytes));
  126. extern void VmMach_NetMapPacket _ARGS_((register Net_ScatterGather
  127.     *inScatGathPtr, register int scatGathLength,
  128.     register Net_ScatterGather *outScatGathPtr));
  129. /*
  130.  * Context routines.
  131.  */
  132. extern int VmMach_GetContext _ARGS_((Proc_ControlBlock *procPtr));
  133. extern void VmMach_FlushCurrentContext _ARGS_((void));
  134.  
  135. /*
  136.  * File Cache routines.
  137.  */
  138. extern void VmMach_LockCachePage _ARGS_((Address kernelAddress));
  139. extern void VmMach_UnlockCachePage _ARGS_((Address kernelAddress));
  140.  
  141. #endif /* _VMMACH */
  142.